<template>
<view class="scroll_container" @click="toTop" v-show="isShow">
  <image
  src="https://cdn-cos-ke.myoed.com/ke_proj/mobilev2/m-core/03de0936a7aafee76646b8b2d5fa5b4f.png"
  mode="scaleToFill"
/>
</view>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import {onLoad,onPageScroll} from '@dcloudio/uni-app'
let isShow = ref(false)
function toTop(){
  uni.pageScrollTo({
	scrollTop: 0,
	duration: 300
});
}
onLoad(()=>{
  uni.$on('pageScroll',(scrollTop)=>{
      if(scrollTop>200){
        isShow.value = true;
      }else{
        isShow.value = false;
      }
  })
})
</script>

<style scoped lang="less">
.scroll_container{
  position: fixed;
  bottom: 80rpx;
  right: 20rpx;
  image{
    width: 100rpx;
    height: 100rpx;
  }
}
</style>